<template>
  <div>
    <el-button type="primary" @click="isOPenDialog = true">打开弹窗</el-button>
    <div class="dialog-mask" v-if="isOPenDialog">
      <div class="dialog-box">
        <div class="customer-dialog">
          <div class="customer-dialog-close" @click="isOPenDialog = false">×</div>
          <div class="customer-dialog-header">弹窗标题</div>
          <div class="customer-dialog-body">这是弹窗里的内容</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, reactive } from "vue";
const isOPenDialog = ref(false);
</script>

<style lang="less" scoped>
@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes rightBootomIn {
  0% {
    top: -50%;
    left: 50%;
  }
  100% {
    top: 40%;
    left: 50%;
  }
}

.dialog-mask {
  width: calc(100vw - 245px);
  height: calc(100vh - 36px);
  position: fixed;
  top: 13px;
  left: 225px;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1;
  animation: fadeIn 0.5s ease-in-out;
}

.dialog-box {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: rightBootomIn 0.5s ease-in-out;
  .customer-dialog {
    position: relative;
    min-width: 500px;
    min-height: 300px;
    background-color: #fff;
    border-radius: 20px;
    .customer-dialog-close {
      position: absolute;
      right: 10px;
      top: 10px;
      font-size: 20px;
      cursor: pointer;
      width: 20px;
      height: 20px;
      line-height: 20px;
      text-align: center;
    }
    .customer-dialog-header {
      box-sizing: border-box;
      width: 100%;
      height: 50px;
      border-bottom: 1px solid #e0e0e0;
      border-radius: 20px 20px 0 0;
      line-height: 50px;
      padding-left: 20px;
      font-size: 18px;
    }
    .customer-dialog-body {
      width: 100%;
      height: calc(100% - 50px);
      padding: 20px;
      overflow-y: auto;
    }
  }
}
</style>
